﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Rankings : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        var seasonQuery = Request.QueryString["Season"];
        Season s = null;

        if (seasonQuery != null)
            s = DataBase.Seasons.GetSeasonWithID(seasonQuery);
        else
            s = DataBase.Seasons.GetCurrentSeason();

        var rankings = DataBase.Seasons.GetSeasonStandingsByGames(s.ID.ToString());
        dgRankingsByGame.DataSource = rankings;
        dgRankingsByGame.DataBind();

        dgRankingsByWeek.DataSource = DataBase.Seasons.GetSeasonStandingsByWeeksWon(s.ID.ToString());
        dgRankingsByWeek.DataBind();

        seasonsControl.GenerateSeasons(s, "Rankings.aspx");
    }
}